<?php
require 'user.php';
require 'function.php';
require 'pclzip.lib.php';
if((is_file($path=_decode($_GET['path']))==false)) {
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
Error：404
HTML;
exit;
}
header('Content-Type: text/html; charset=UTF-8');
echo <<<HTML
<html>
<head>
<title>文件管理－解压文件</title>
<style type="text/css">
.big_board{background-color:#009BCE;color:#FFF;}
.board_title{margin-bottom:1px;border:1px solid #09F;}
</style>
</head>
<body>
<div class="big_board"><div class="board_title">爱特文管－路径信息</div></div>
HTML;
echo '<a href="index.php?path=',_encode($dir=dirname($path)),'">',$dir=realpath($dir),'</a>/',basename($path);
if(!$_POST['go'])
{
echo <<<HTML
<div class="big_board"><div class="board_title">解压文件  解压目录</div></div>
<form method="post" action="unpkzip.php?path={$_GET['path']}">
<input name="dir" value="$dir"/>
<input type="submit" name="go" value="解压"/>
</form>
HTML;
} else {
$pk=new pclzip($path);
echo <<<HTML
<div class="big_board"><div class="board_title">解压文件－解压结果</div></div>
HTML;
if($cnt=$pk->extract(PCLZIP_OPT_PATH,$_POST['dir'])) {
echo 'Hello,压缩包 '.basename($path).' 解压成功!<br/>解压文件个数:',count($cnt);
} else {
echo 'Hello,压缩包 '.basename($path).' 解压失败!';

}
}
echo <<<HTML
<div class="big_board"><div class="board_title">By：Admin@Lspecial.Com</div></div>
HTML;
unset($_SESSION['path']);
?>